<?php
namespace ApplicationTest\Modelservicetest;

use Application\Model\Paciente;
use PHPUnit_Framework_TestCase;

class PacienteTest extends PHPUnit_Framework_TestCase
{
    public function testPacienteInitialState()
    {
        $paciente = new Paciente();

        $this->assertNull($paciente->artist, '"artist" should initially be null');
        $this->assertNull($paciente->id, '"id" should initially be null');
        $this->assertNull($paciente->title, '"title" should initially be null');
    }

    public function testExchangeArraySetsPropertiesCorrectly()
    {
        $paciente = new Paciente();
        $data  = array('artist' => 'some artist',
                       'id'     => 123,
                       'title'  => 'some title');

        $paciente->exchangeArray($data);

        $this->assertSame($data['artist'], $paciente->artist, '"artist" was not set correctly');
        $this->assertSame($data['id'], $paciente->id, '"id" was not set correctly');
        $this->assertSame($data['title'], $paciente->title, '"title" was not set correctly');
    }

    public function testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent()
    {
        $paciente = new Paciente();

        $paciente->exchangeArray(array('artist' => 'some artist',
                                    'id'     => 123,
                                    'title'  => 'some title'));
        $paciente->exchangeArray(array());

        $this->assertNull($paciente->artist, '"artist" should have defaulted to null');
        $this->assertNull($paciente->id, '"id" should have defaulted to null');
        $this->assertNull($paciente->title, '"title" should have defaulted to null');
    }
}